#pragma once
#include<iostream>
#include<vector>
#include<assert.h>
using namespace std;

template<size_t N=100>
class bitset {
public:
	bitset() {
		f.resize(N / 32 + 1, 0);
	}
	void set(size_t n) {
		assert(n <= N);
		size_t pos = n / 32;
		size_t pos1 = n % 32;
		f[pos] |= (1 << pos1);
	}
	void reset(size_t n) {
		assert(n <= N);
		size_t pos = n / 32;
		size_t pos1 = n % 32;
		f[pos] &= ~(1 << pos1);
	}
	bool testvalue(size_t n) {
		assert(n <= N);
		size_t pos = n / 32;
		size_t pos1 = n % 32;
		return f[pos] & (1 << pos1);
	}
private:
	vector<int>f;
};

template<size_t N=100>
class two_bitset {
public:
	void set(size_t n) {
		if (b2.testvalue(n) == 0)b2.set(n);
		else {
			if (b1.testvalue(n) == 0) {
				b1.set(n);
				b2.reset(n);
			}
		}
	}
	bool testvalue(size_t n) {
		if (b1.testvalue(n) == 1 && b2.testvalue(n) == 1)return false;
		return true;
	}
private:
	bitset<N>b1;
	bitset<N>b2;
};